// Copyright 2022 marcello<volibearw@gmail.com>. All rights reserved.

package main

// generateModelImportPart 组成 import 部分
func generateModelImportPart(param *CLIParam) string {
	var importStr string
	if param.ModelUseGorm {
		if importStr == "" {
			importStr = generateModelInitImportString(false)
		}
		importStr += "    \"" + ImportGormPath + "\"\n"
	}

	if param.ModelImportPbPath != "" {
		if importStr == "" {
			importStr = generateModelInitImportString(false)
		}
		importStr += "    pb \"" + param.ModelImportPbPath + "\"\n"
	}

	if importStr != "" {
		importStr += generateModelInitImportString(true)
	}

	return importStr
}

func generateModelInitImportString(last bool) string {
	if last {
		return ")\n"
	}
	return "import (\n"
}
